﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using PLM.ConfigurationCenter.Service;
using Quartz;

namespace PLM.ConfigurationCenter.Jobs {
    /// <summary>
    /// 
    /// </summary>
    [DisallowConcurrentExecution]
    public class AutoStartJob : IJob {
        /// </summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public async Task Execute(IJobExecutionContext context) {
            Action Job = null;
            await Task.Run(() => {
                Job = (Action)context.JobDetail.JobDataMap.Get("action");
                Job?.Invoke();
            });
        }
    }
}
